# Contributor: Hoang Nguyen <folliekazetani@protonmail.com>
# Maintainer: Hoang Nguyen <folliekazetani@protonmail.com>
pkgname=primecount
pkgver=7.9
pkgrel=0
pkgdesc="Fast prime counting C/C++ library"
url="https://github.com/kimwalisch/primecount"
arch="all !aarch64 !s390x" # iroot test failed
license="BSD-2-Clause"
makedepends="
	cmake
	samurai
	primesieve-dev
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs"
source="$pkgname-$pkgver.tar.gz::https://github.com/kimwalisch/primecount/archive/refs/tags/v$pkgver.tar.gz"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DBUILD_SHARED_LIBS=ON \
		-DBUILD_TESTS=ON \
		-DBUILD_LIBPRIMESIEVE=OFF \
		-DWITH_POPCNT=OFF
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
420d945dbc08db33cf6b367a0c748cfc631dd633d93df77f1ebaeb5855a5944c91123af610f87e19ccda15337f94e2971b12a7182428b34ff5378177fd6e7bce  primecount-7.9.tar.gz
"
